using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_TourList : PagedControl
{
    TourDAO daoTour = new TourDAO();
    #region properties
    public override string RequestString
    {
        get
        {
            if (Request["search"] != null) return "Default.aspx?ctrl=article_list&search=" + Request["search"] + "&page=";
            return "Default.aspx?ctrl=tour_list&page=";
        }
    }
    #endregion
    protected void Page_Load(object sender, EventArgs e)
    {
        ActiveAccording = "tour";
        p = Request["page"];
        totals = 0;
        currentPage = GetPageNumber(p);
        LoadData();
    }
    public void LoadData()
    {
        if (Request["search"] == "" || Request["search"] == null)
        {
            dgrTour.DataSource = daoTour.GetTours(currentPage, pageSize,ref totals,ServiceObject.Both);
        }
        else
        {
            dgrTour.DataSource = daoTour.GetToursExt(currentPage, pageSize,ref totals, "%" + Request["search"] + "%",ServiceObject.Both);
        }
        dgrTour.DataBind();
        lblPaging.Text = GetPageGrid(totals,pageSize,currentPage);
    }
}
